package com.zsj.datasource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 建立动态数据源
 * 
 * @author Zsj
 */
public class DynamicDataSource extends AbstractRoutingDataSource {

	private final static Log log = LogFactory.getLog("DynamicDataSource");

	@Override
	protected Object determineCurrentLookupKey() {
		// 在进行DAO操作前，通过上下文环境变量，获得数据源的类型
		return DataSourceContextHolder.getDataSourceType();
	}

}